package com.example.tms.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.tms.entity.EmployeeProject;
import com.example.tms.mapper.EmployeeProjectMapper;

@Service
public class EmployeeProjectService {

    @Autowired
    private EmployeeProjectMapper employeeProjectMapper;

    // 获取所有项目列表
    public List<EmployeeProject> selectAll() {
        return employeeProjectMapper.selectList(null);
    }
    // 根据 ID 查询项目
    public EmployeeProject selectById(Integer id) {
        return employeeProjectMapper.selectById(id);
    }

    // 添加项目信息
    public int insert(EmployeeProject employeeProject) {
        return employeeProjectMapper.insert(employeeProject);
    }

    // 更新部门信息
    public int update(EmployeeProject employeeProject) {
        return employeeProjectMapper.updateById(employeeProject);
    }

    // 根据员工 ID 查询项目
    public List<EmployeeProject> selectByEmpId(EmployeeProject employeeProject) {
        return employeeProjectMapper.selectByEmpId(employeeProject);
    }

    // 根据项目 ID 查询员工
    public List<EmployeeProject> selectByProjectId(Integer proId) {
        return employeeProjectMapper.selectByProId(proId);
    }

    // 删除项目信息
    public int deleteById(Integer id) {
        return employeeProjectMapper.deleteById(id);
    }
}
